<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    

    <script>

        // 正则方法  test   测试某个字符串中是否存在   返回布尔值

        var reg = /good/ ; 

        var str = 'goos good study' ;

        console.log(reg.test(str));   // 判断字符串中是否有good

    </script>
    
</body>
</html>